/*
 * 文 件 名:  ReviewsDescriptionActivity.java
 * 版    权:  Weipu Technologies Co., Ltd. Copyright 2012-2014,  All rights reserved
 * 描    述:  <描述>
 * 修 改 人:  sjx206
 * 修改时间:  2015-1-7
 * 跟踪单号:  <跟踪单号>
 * 修改单号:  <修改单号>
 * 修改内容:  <修改内容>
 */
package com.epro.dx.activity;

import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.RatingBar;
import android.widget.TextView;

import com.epro.dx.R;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.weipu.common.DXApplication;
import com.weipu.common.DXApplication.TrackerName;
import com.weipu.common.facade.model.ReviewlistModel;

/**
 * 评论描述
 * @author  sjx206
 * @version  [版本号, 2015-1-7]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
public class ReviewsDetailActivity extends BaseFragmentActivity
{
    
    private ReviewlistModel reviewModel;
    
    private TextView commentTitle;
    private TextView reviewContent;
    
//    private TextView commentPros;
    
//    private TextView commentCons;
//    
//    private TextView commentOtherThoughts;
//    
//    private TextView commentBottomline;
//    
    private TextView commentNickname;
    
//    private TextView ownershipStatus;
    
    private RatingBar priceRating;
    
    private RatingBar easeOfUseRating;
    
    private RatingBar buildQualityRating;
    
    private RatingBar valueRating;
    
    private RatingBar overallRating;
    
    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        Tracker tracker = DXApplication.getContext().getTracker(TrackerName.APP_TRACKER);
        tracker.setScreenName(ReviewsDetailActivity.class.getSimpleName());
        tracker.send(new HitBuilders.ScreenViewBuilder().build());
        // 不显示标题
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_reviewsdescription);
        setTitleContent("Reviews");
        initView();
        initData();
    }
    
    /**
     * 初始化相关
     */
    private void initView()
    {
        priceRating = (RatingBar)findViewById(R.id.PriceRating);
        easeOfUseRating = (RatingBar)findViewById(R.id.EaseOfUseRating);
        buildQualityRating = (RatingBar)findViewById(R.id.BuildQualityRating);
        valueRating = (RatingBar)findViewById(R.id.ValueRating);
        overallRating = (RatingBar)findViewById(R.id.overallRating);
//        ownershipStatus = (TextView)findViewById(R.id.ownershipStatus);
        commentTitle = (TextView)findViewById(R.id.commentTitle);
        reviewContent=(TextView) findViewById(R.id.reviews_content);
//        commentPros = (TextView)findViewById(R.id.commentPros);
//        commentCons = (TextView)findViewById(R.id.commentCons);
//        commentOtherThoughts = (TextView)findViewById(R.id.commentOtherThoughts);
//        commentBottomline = (TextView)findViewById(R.id.commentBottomLine);
        
        commentNickname = (TextView)findViewById(R.id.customer_name);
        setLeftBtnContent(true, -1);
    }
    
    private void initData()
    {
    	Bundle bundle=getIntent().getExtras();
    	if(null==bundle){
    		return;
    	}
        reviewModel = (ReviewlistModel)bundle.getSerializable("reviewModel");
        if (null != reviewModel)
        {
            // 商品价格评价
            if (reviewModel.getPriceRating() > 0)
            {
                priceRating.setRating(reviewModel.getPriceRating());
            }
            else
            {
                priceRating.setVisibility(View.GONE);
            }
            // 商品易用性评价
            if (reviewModel.getEaseOfUseRating() > 0)
            {
                easeOfUseRating.setRating(reviewModel.getEaseOfUseRating());
            }
            else
            {
                easeOfUseRating.setVisibility(View.GONE);
            }
            // 商品制作质量评价
            if (reviewModel.getBuildQualityRating() > 0)
            {
                buildQualityRating.setRating(reviewModel.getBuildQualityRating());
            }
            else
            {
                buildQualityRating.setVisibility(View.GONE);
            }
            //商品价值评价
            if (reviewModel.getValueRating() > 0)
            {
                valueRating.setRating(reviewModel.getValueRating());
            }
            else
            {
                valueRating.setVisibility(View.GONE);
            }
            //总体评价
            if (reviewModel.getOverallRating() > 0)
            {
                overallRating.setRating(reviewModel.getOverallRating());
            }
            else
            {
                overallRating.setVisibility(View.GONE);
            }
            
            //作者对产品的了解程度
            //            techLevel.setText(reviewModel.getTechLevel());
            //对此物品的持有状态，如：三年，四年等
//            ownershipStatus.setText(getString(R.string.reviews_ownership, new Object[] {reviewModel.getTechLevel(),
//                reviewModel.getOwnershipStatus()}));
            //商品评论标题
            commentTitle.setText(reviewModel.getSubject());
            //优点
//            commentPros.setText(reviewModel.getPros());
            //缺点
//            commentCons.setText(reviewModel.getCons());
            //其它看法
//            commentOtherThoughts.setText(reviewModel.getOtherThoughts());
            //结论
//            commentBottomline.setText(reviewModel.getBottomline());
            //商品评论人昵称和时间
            commentNickname.setText(getString(R.string.detail_reviews_time, new Object[] {reviewModel.getUsername(),
                reviewModel.getTimestamp()}));
            //商品评论内容
            reviewContent.setText(reviewModel.getContent());
        }
    }
    
}
